/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.expert.service;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.Order;
import org.hibernate.criterion.Restrictions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

import com.chlitina.store.common.service.BaseService;
import com.chlitina.store.modules.expert.dao.SolutionFaceFoodLocationSeasonDao;
import com.chlitina.store.modules.expert.entity.SolutionFaceFood;
import com.chlitina.store.modules.expert.entity.SolutionFaceFoodLocationSeason;

/**
 * 方案健康食品区域季节Service
 * @author liujiang
 * @version 2014-02-17
 */
@Component
@Transactional(readOnly = true)
public class SolutionFaceFoodLocationSeasonService extends BaseService {

	@SuppressWarnings("unused")
	private static Logger logger = LoggerFactory.getLogger(SolutionFaceFoodLocationSeasonService.class);
	
	@Autowired
	private SolutionFaceFoodLocationSeasonDao solutionFaceFoodLocationSeasonDao;
	
	public List<SolutionFaceFoodLocationSeason> getBy(SolutionFaceFood solutionFaceFood) {
		DetachedCriteria dc = solutionFaceFoodLocationSeasonDao.createDetachedCriteria();
		dc.add(Restrictions.eq("solutionFace", solutionFaceFood.getSolutionFace()));
		dc.add(Restrictions.eq("product", solutionFaceFood.getProduct()));
		dc.addOrder(Order.asc("systemDefinitionAreaSeason.id"));
		return solutionFaceFoodLocationSeasonDao.find(dc);
	}
	
	
	@Transactional(readOnly = false)
	public void save(SolutionFaceFoodLocationSeason solutionFaceFoodLocationSeason) {
		solutionFaceFoodLocationSeasonDao.save(solutionFaceFoodLocationSeason);
	}
	
	@Transactional(readOnly = false)
	public void delete(Long mid, Long pid, Long tid) {
		solutionFaceFoodLocationSeasonDao.delete(mid, pid, tid);
	}
	
}
